/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yaps.petstore.service;

import com.yaps.petstore.dao.CategoryDAO;
import com.yaps.petstore.dao.ItemDAO;
import com.yaps.petstore.dao.ProductDAO;
import com.yaps.petstore.entity.catalog.Category;
import com.yaps.petstore.entity.catalog.Item;
import com.yaps.petstore.entity.catalog.Product;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

/**
 *
 * @author pfa
 */

@Service("CatalogService")
public class CatalogService  implements ICatalogService{

    @Autowired
    private CategoryDAO  categoryDAO;
    @Autowired
    private ItemDAO itemDAO;
    @Autowired
    private ProductDAO productDAO;
    
    public Category findCategory(Long categoryId) {
        return  categoryDAO.findCategory(categoryId);
    }

    public Product findProduct(Long productId) {
       return productDAO.findProduct(productId);
    }

    public Item findItem(Long itemId) {
        return  itemDAO.findItem(itemId);
    }

    public List<Item> searchItems(String keyword) {
        return itemDAO.searchItems(keyword);
    }

    public Category createCategory(Category category) {
         return categoryDAO.createCategory(category);
    }

    public void deleteCategory(Category category) {
         categoryDAO.deleteCategory(category);
    }

    public Category updateCategory(Category category) {
        return categoryDAO.updateCategory(category);
    }

    public List<Category> findCategories() {
        return categoryDAO.findCategories();
    }

    public Product createProduct(Product product, Category category) {
       return productDAO.createProduct(product, category);
    }

    public void deleteProduct(Product product) {
        productDAO.deleteProduct(product);
    }

    public Product updateProduct(Product product, Category category) {
        return productDAO.updateProduct(product, category);
    }
    public List<Product> findProducts() {
       return productDAO.findProducts();
    }

    public Item createItem(Item item, Product product) {
        return itemDAO.createItem(item, product);
    }

    public void deleteItem(Item item) {
        itemDAO.deleteItem(item);
    }

    public Item updateItem(Item item, Product product) {
        return itemDAO.updateItem(item, product);
    }

    public List<Item> findItems() {
       return itemDAO.findItems();
    }

    
}
